class info {

  constructor () {
    this.param = '';
  }

  async get (c) {
    let r = await c.service.pgorm().table('users')
                  .where('id=?',[c.box.user.id])
                  .select('points,frozen_points,role,wxinfo');
    if (r.rowCount <= 0) {
      c.res.body = {
        status : 'FAILED',
        errmsg : '获取失败'
      };return ;
    }
    let u = r.rows[0];
    try {
      u.wxinfo = JSON.parse(u.wxinfo);
      delete u.wxinfo.openid;
    } catch (err) {
    }

    c.res.body = {
      status : 'OK',
      data : u
    };
  }

}

module.exports = info;
